package org.luxor.storage.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import org.luxor.commons.core.utils.DateUtils;
import org.luxor.commons.core.validator.group.UpdateGroup;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * OSS文件对象
 *
 * @author Mr.yan @date 2020/3/11
 */
@TableName("tb_sys_oss_file")
public class OssFileEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "OSS文件对象ID")
    @NotNull(message = "ID不能为空", groups = UpdateGroup.class)
    private Long id;

    /**
     * 中文名称备注
     */
    @NotBlank(message = "中文名称备注不能为空")
    @ApiModelProperty(value = "中文名称备注")
    private String remarkName;

    /**
     * URL地址
     */
    @NotBlank(message = "URL地址不能为空")
    @ApiModelProperty(value = "URL地址")
    private String url;

    /**
     * 存储类型
     */
    @NotBlank(message = "存储类型不能为空")
    @ApiModelProperty(value = "存储类型(1：本地磁盘 2：FastDfs 3：七牛  4：阿里云  5：腾讯云)")
    private Integer storageType;

    /**
     * 文件存储路径
     */
    @NotBlank(message = "文件存储路径不能为空")
    @ApiModelProperty(value = "文件存储路径")
    private String fileFullPath;

    /**
     * md5文件唯一识别码
     */
    @NotBlank(message = "md5文件唯一识别码不能为空")
    @ApiModelProperty(value = "md5文件唯一识别码")
    private String md5;

    /**
     * 文件字节大小
     */
    @ApiModelProperty(value = "文件字节大小" )
    private Long fileSize;

    /**
     * 文件类型
     */
    @ApiModelProperty(value = "文件类型", example = "image/jpeg")
    private String contentType;

    /**
     * 文件后缀名
     */
    @ApiModelProperty(value = "文件后缀名", example = ".jpg")
    private String filePostfix;

    @NotBlank(message = "最后修改时间不能为空")
    @ApiModelProperty(value = "最后修改时间", example = "2020/03/22 23:23:02")
    @JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN, timezone = "GMT+8")
    private Date updateTime;

    public OssFileEntity() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getStorageType() {
        return storageType;
    }

    public void setStorageType(Integer storageType) {
        this.storageType = storageType;
    }

    public String getRemarkName() {
        return remarkName;
    }

    public void setRemarkName(String remarkName) {
        this.remarkName = remarkName;
    }

    public String getFileFullPath() {
        return fileFullPath;
    }

    public void setFileFullPath(String fileFullPath) {
        this.fileFullPath = fileFullPath;
    }

    public Long getFileSize() {
        return fileSize;
    }

    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }

    public String getContentType() {
        return contentType;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    public String getFilePostfix() {
        return filePostfix;
    }

    public void setFilePostfix(String filePostfix) {
        this.filePostfix = filePostfix;
    }

    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "OssFileEntity{" +
                "id=" + id +
                ", remarkName='" + remarkName + '\'' +
                ", url='" + url + '\'' +
                ", storageType=" + storageType +
                ", fileFullPath='" + fileFullPath + '\'' +
                ", md5='" + md5 + '\'' +
                ", fileSize=" + fileSize +
                ", contentType='" + contentType + '\'' +
                ", filePostfix='" + filePostfix + '\'' +
                ", updateTime=" + updateTime +
                '}';
    }
}
